package com.lovo.ssc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.ssc.dto.OrderDto;
import com.lovo.ssc.entity.Customer;
import com.lovo.ssc.entity.Ordergoods;
import com.lovo.ssc.entity.SysOrder;
import com.lovo.ssc.mapper.SysOrderMapper;
import com.lovo.ssc.service.ISysOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author lovo
 * @since 2022-07-08
 */
@Service
public class SysOrderServiceImpl extends ServiceImpl<SysOrderMapper, SysOrder> implements ISysOrderService {


    @Override
    public int addOrder(SysOrder order) {
        baseMapper.addOrder(order);
        return order.getOrderid();
    }

    @Override
    public List<OrderDto> findAll() {
        return baseMapper.findAll();
    }

    @Override
    public List<OrderDto> findByItem(String type, String startTime, String endTime) {
        return baseMapper.findByItem(type, startTime, endTime);
    }

    @Override
    public List<Ordergoods> findById(int orderId) {
        return baseMapper.findById(orderId);
    }

    @Override
    public Customer findByUserName(String userName) {
        return baseMapper.findByUserName(userName);
    }
}
